package com.example.day2.methodref;

import java.util.function.Consumer;
import java.util.function.Function;

public class MethodRef7 {
    public static void main(String[] args) {
        Consumer<Object> x = MethodRef7::print1;
        Function<Object, Integer> y = MethodRef7::print2;
        // 特例:不关心返回的结果 因为print2是接收一个参数的返回一个接口和Function对应上
        // 如果我们不关心返回的结果,那么就可以使用Consumer
        Consumer<Object> z = MethodRef7::print2;

    }

    static void print1(Object obj) {
        System.out.println(obj);
    }

    static int print2(Object obj) {
        System.out.println(obj);
        return 1;
    }
}
